home *** CD-ROM | disk | FTP | other *** search
- package com.sun.java.swing.plaf.metal;
-
- import com.sun.java.swing.JToolBar;
- import com.sun.java.swing.border.AbstractBorder;
- import java.awt.Component;
- import java.awt.Graphics;
- import java.awt.Insets;
-
- public class MetalToolBarBorder extends AbstractBorder {
- protected MetalBumps bumps = new MetalBumps(10, 10, MetalLookAndFeel.getControlHighlight(), MetalLookAndFeel.getControlDarkShadow(), MetalLookAndFeel.getMenuBackground());
-
- public Insets getBorderInsets(Component c) {
- Insets borderInsets = new Insets(2, 2, 2, 2);
- if (((JToolBar)c).isFloatable()) {
- if (c.getSize().height <= c.getSize().width) {
- borderInsets.left = 16;
- } else {
- borderInsets.top = 16;
- }
- }
-
- return borderInsets;
- }
-
- public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
- g.translate(x, y);
- if (((JToolBar)c).isFloatable()) {
- if (c.getSize().height <= c.getSize().width) {
- this.bumps.setBumpArea(10, c.getSize().height - 4);
- this.bumps.paintIcon(c, g, 2, 2);
- } else {
- this.bumps.setBumpArea(c.getSize().width - 4, 10);
- this.bumps.paintIcon(c, g, 2, 2);
- }
- }
-
- g.translate(-x, -y);
- }
- }
-